Skip to content

Fix: Renaming a judging room/table preserves list order#2112

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-judging-room-name-bug
Draft

Fix: Renaming a judging room/table preserves list order#2112
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-judging-room-name-bug

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 4, 2026

Description

Renaming a judging room or robot game table in the admin venue page caused the item to jump to the bottom of the list. This happened because the rename triggered a full SWR re-fetch, and the server returns items sorted alphabetically — placing the renamed item at its new alphabetical position.

Fix: Use SWR's bound mutate to update the renamed item in-place in the cache instead of invalidating and re-fetching:

// Before: triggers full re-fetch → item re-sorted alphabetically by server
mutate(`/admin/events/${division.eventId}/divisions/${division.id}/${assetType}`);

// After: updates name in-place → list order preserved
updateAssets(
  currentAssets => currentAssets?.map(a => (a.id === asset.id ? { ...a, name } : a)) as T[],
  { revalidate: false }
);

Add and delete operations continue to use a full re-fetch (correct behavior for those cases).

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Screenshots

N/A — order now stays stable after renaming a room or table.

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • My changes generate no new warnings

Copilot AI changed the title [WIP] Fix bug that moves judging room to the bottom after renaming Fix: Renaming a judging room/table preserves list order May 4, 2026
Copilot AI requested a review from johnmeshulam May 4, 2026 08:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

Renaming a judging room or robot game table moves it to the bottom of the list

2 participants